﻿using System.Collections.Generic;
using UnityEngine;
public enum GameStateEnum
{
    Player, Dialogue
}


public class GameStateManager : PersistentSingleton<GameStateManager>
{
    private GameStateMachina stateMachina;
    private Dictionary<string, IGameState> stateDictionary;

    private void Start()
    {
        stateMachina = gameObject.AddComponent<GameStateMachina>();
        gameObject.AddComponent<StateEventManager>();

        // 初始化状态字典
        stateDictionary = new Dictionary<string, IGameState>
        {
            { "Play", new PlayState() },
            { "Dialogue", new DialogueState() }
            // 其他状态...
        };

        stateMachina.SwitchState(stateDictionary["Play"]);
    }

    public void TriggerDialogue(DialougeData data)
    {
        stateMachina.SwitchState(stateDictionary["Dialogue"], data);
    }
    public void SwitchPlay()
    {
        stateMachina.SwitchState(stateDictionary["Play"]);
    }


    //private void Update()
    //{
    //    if (Input.GetKeyDown(KeyCode.Escape))
    //    {
    //        Debug.Log(GetType().Name + " 测试切换状态");
    //        TriggerDialogue(DialouageManager.instance.GetData(0));
    //    }
    //}
}
